<?php
	
class Table_Articles extends Zend_Db_Table_Abstract
{
    protected $_name    = 'article';
    protected $_primary = 'ARTICLE_NUMERO';
    protected $_sequence = true; //la table a un autoincrément
 	
    
    public function getArticleVip($id){
    	return $this->fetchRow($this
    		->select()
    		->where("ARTICLE_NUMERO = ?", $id)
    		);
    }
    
	public function insertArticle($titre,$contenu,$exemplaire,$pagedeb){
		$data = array('ARTICLE_TITRE'=> $titre,
					  'ARTICLE_NUMEROPAGEDEBUT'=> $pagedeb,
					  'ARTICLE_RESUME'=> $contenu,
					  'EXEMPLAIRE_NUMERO'=> $exemplaire,
					  'ARTICLE_DATE_INSERT'=> date("Y-m-d"));
		return $this->insert($data);
	}
	
	public function deleteArticle($numart){
		$this->delete('ARTICLE_NUMERO = '.$numart);
	}
	
	public function updateArticle($titre, $page, $contenu, $numArt){
		$data = array('ARTICLE_TITRE' => $titre,
					  'ARTICLE_NUMEROPAGEDEBUT' => $page,
					  'ARTICLE_RESUME' => $contenu);
		$where = $this->getAdapter()->quoteInto('ARTICLE_NUMERO = ?', $numArt);
		return $this->update($data, $where);
	}
}
?>